package o;

import androidx.annotation.Nullable;
import com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.e;
import o.aea.a;

public final class aex implements e {
    private final long ˊ;
    private final long[] ˋ;
    private final long[] ˎ;
    private final long ˏ;

    @Nullable
    public static aex ॱ(long j, long j2, aed o_aed, anc o_anc) {
        o_anc.ˎ(10);
        int ॱᐝ = o_anc.ॱᐝ();
        if (ॱᐝ <= 0) {
            return null;
        }
        int i = o_aed.ˊ;
        long ॱ = anr.ॱ((long) ॱᐝ, ((long) (i >= 32000 ? 1152 : 576)) * 1000000, (long) i);
        int ॱॱ = o_anc.ॱॱ();
        int ॱॱ2 = o_anc.ॱॱ();
        int ॱॱ3 = o_anc.ॱॱ();
        o_anc.ˎ(2);
        long j3 = j2 + ((long) o_aed.ॱ);
        long[] jArr = new long[ॱॱ];
        long[] jArr2 = new long[ॱॱ];
        long j4 = j2;
        for (int i2 = 0; i2 < ॱॱ; i2++) {
            jArr[i2] = (((long) i2) * ॱ) / ((long) ॱॱ);
            jArr2[i2] = Math.max(j4, j3);
            switch (ॱॱ3) {
                case 1:
                    ॱᐝ = o_anc.ʽ();
                    break;
                case 2:
                    ॱᐝ = o_anc.ॱॱ();
                    break;
                case 3:
                    ॱᐝ = o_anc.ˏॱ();
                    break;
                case 4:
                    ॱᐝ = o_anc.ʽॱ();
                    break;
                default:
                    return null;
            }
            j4 += (long) (ॱᐝ * ॱॱ2);
        }
        if (!(j == -1 || j == j4)) {
            amz.ˏ("VbriSeeker", "VBRI data size mismatch: " + j + ", " + j4);
        }
        return new aex(jArr, jArr2, ॱ, j4);
    }

    private aex(long[] jArr, long[] jArr2, long j, long j2) {
        this.ˋ = jArr;
        this.ˎ = jArr2;
        this.ˏ = j;
        this.ˊ = j2;
    }

    public boolean ˊ() {
        return true;
    }

    public a ˏ(long j) {
        int ˊ = anr.ˊ(this.ˋ, j, true, true);
        aeh o_aeh = new aeh(this.ˋ[ˊ], this.ˎ[ˊ]);
        if (o_aeh.ˊ >= j || ˊ == this.ˋ.length - 1) {
            return new a(o_aeh);
        }
        return new a(o_aeh, new aeh(this.ˋ[ˊ + 1], this.ˎ[ˊ + 1]));
    }

    public long ˋ(long j) {
        return this.ˋ[anr.ˊ(this.ˎ, j, true, true)];
    }

    public long g_() {
        return this.ˏ;
    }

    public long ˎ() {
        return this.ˊ;
    }
}
